import store from '@/store'

export default {
  methods: {
    checkPermission(key) {
      const { userInfo } = store.state.user
      if (userInfo.roles && userInfo.roles.points && userInfo.roles.points.length) {
        //   可选链写法(加个问号)，ie8不兼容
        //   if (userInfo.roles?.points && userInfo.roles.points.length) {

        return userInfo.roles.points.some(item => item === key)
      }
      //   return userInfo.roles.points.some(item => item === key)

      return false
    }
  }
}
